import java.util.*;
public class Test {
        public static void main(String[] args){
            Scanner scanner = new Scanner(System.in);
            while(scanner.hasNext()){
                String str1 = scanner.next();
                String str2 = scanner.next();

                Map<Character, Integer> map = new HashMap<>();
                for(char x : str1.toCharArray()){
                    if(map.get(x) == null){
                        map.put(x, 1);
                    }else{
                        int val = map.get(x);
                        map.put(x, val + 1);
                    }
                }

                int count = 0;
                for(char x : str2.toCharArray()){

                    if(map.get(x) != null || map.get(x) > 0){
                        int val = map.get(x);
                        map.put(x, val - 1);
                        count++;
                    }
                }
                System.out.println(count);
            }
        }
    }

